#ifndef __EVENT_
#define __EVENT_

#include "mymath.h"
#include "interval_from_real.h"
#include "bool_interval.h"
#include "interval_from_real.h"
#include "draw.h"
#include "font.h"
#include "header.h"
#include "formula_sytanmic.h"
#include <sstream>

class Event {
public:
    Event();
    ~Event();
    void EventLoop();

private:
    SDL_Event* event_;
    Font* font_ = nullptr;
    const Uint32 MIN_FPS_TIME = 16;
    long fps_time_ = 0;
    bool isquit_ = false;
    bool firstRun_ = true;
    void EventHandle();
    void FlashFont();

    string lexpres_ = "";
    string rexpres_ = "";
    Formula lformula_;
    Formula rformula_;
    void initlrExprs();

    Draw<DTInterval> draw_;
    using I_type = decltype(draw_)::I_type;

    bool isrender_ = true;
    bool nextStep_ = true;
    bool renderGrid_ = true;
    bool renderGraph_= true;
    bool renderFont_ = true;
    int totalStep_ = 1;
    SDL_Point fontxy_ = {0, 0};

    bool dragging_ = false;
    SDL_Point dragStart_ = {0, 0};
    SDL_Point dragEnd_ = {0, 0};
};

#endif
